import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import GamePage from '@/views/Game.vue'
import PlanePlay from '@/games/planePlay.vue'
import Game2048 from '@/games/2048.vue'
import Tetris from '@/games/Tetris.vue'
import ProjectDetail from '@/components/ProjectDetail.vue'
import ToolsPage from '@/views/ToolsPage.vue'

const routes = [
  {
    path: '/ProjectDetail',
    name: 'ProjectDetail',
    component: ProjectDetail
  },
  {
    path: '/ProjectDetail/:id',
    name: 'ProjectDetailWithId',
    component: ProjectDetail,
    props: true
  },
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/game',
    name: 'GamePage',
    component: GamePage
  },
  {
    path: '/game/plane',
    name: 'PlaneGame',
    component: PlanePlay
  },
  {
    path: '/game/2048',
    name: 'Game2048',
    component: Game2048
  },
  {
    path: '/game/tetris',
    name: 'Tetris',
    component:Tetris
  },
  {
    path: '/tools',
    name: 'ToolsPage',
    component: ToolsPage
  }
]

const router = createRouter({
  routes,
  history: createWebHistory(import.meta.env.BASE_URL || '/'),
  scrollBehavior() {
    return { top: 0 }
  }
})

export default router